const http = (obj) => {
	return new 	Promise((resolve,reject) => {
		uni.request({
			// #ifndef MP-WEIXIN
			url: '/api' + obj.url,
			// #endif
			
			// #ifdef MP-WEIXIN
			url:'http://localhost:3000' + obj.url,
			// #endif
			
			method:obj.method || 'GET',
			data:obj.data || {},
			header:obj.header || {
				'content-type':'application/json',
				 authorization:uni.getStorageSync('userInfo') ? uni.getStorageSync('userInfo').token : ''
			},
			success(res) {
				resolve(res)
			},
			fail(err) {
				reject(err)
			}
		})
	})
}

export default http